package 华为OD机试真题2023.基础题;

import java.io.File;
import java.io.FileNotFoundException;
import java.sql.SQLOutput;
import java.util.Scanner;

public class HJ18_获取最大软件版本号 {
    public static void main(String[] args) throws FileNotFoundException {
        Scanner in = new Scanner(new File("src/main/java/华为OD机试真题2023/基础题/input/18.txt"));
        String s1 = in.nextLine();
        String s2 = in.nextLine();
        String[] s1Array = s1.split("\\.");
        String[] s2Array = s2.split("\\.");
        for (int i = 0; i < 2; i++) {
            int s1Num = Integer.parseInt(s1Array[i]);
            int s2Num = Integer.parseInt(s2Array[i]);
            if (s1Num != s2Num) {
                System.out.println(s1Num > s2Num ? s1 : s2);
                return;
            }
        }
        if (s1Array.length > 2 && s2Array.length > 2) {
            String[] ss1Array = s1Array[2].split("-");
            String[] ss2Array = s2Array[2].split("-");
            int s1Num = Integer.parseInt(ss1Array[0]);
            int s2Num = Integer.parseInt(ss2Array[0]);
            if (s1Num != s2Num) {
                System.out.println(s1Num >= s2Num ? s1 : s2);
                return;
            }
            if (ss1Array.length > 1 && ss2Array.length > 1) {
                System.out.println(ss1Array[1].compareTo(ss2Array[1]) >= 0 ? s1 : s2);
            } else {
                System.out.println(ss1Array.length >= ss2Array.length ? s1 : s2);
            }
        } else {
            System.out.println(s1Array.length >= s2Array.length ? s1 : s2);
        }
    }

}
